<?php

use yii\helpers\Html;
use wodrow\yii2wtools\tools\JsBlock;
use wodrow\yii2wtools\tools\Tree;
use common\Tools;
use kartik\form\ActiveForm;
use fztadmin\modules\rbac\widgets\role_menu_fun_sel\RoleMenuFunSel;

/* @var $this yii\web\View */
/* @var $model fztadmin\modules\rbac\models\forms\AdminRole */

$checkedAdminPowers = $model->getCheckedAdminPowers(1);
$powerTree = Tree::list2tree($checkedAdminPowers, null);
$this->title = "权限设置";
?>

<div>
    <div class="row">
        <div class="col-sm-12">
            <?php $form = ActiveForm::begin(); ?>
            <?=$form->field($model, 'id')->hiddenInput()->label(false) ?>
            <?=RoleMenuFunSel::widget(['model' => $model, 'tree_data' => $powerTree, 'attribute' => 'has_is_checked_powers']) ?>
            <?php if (!Yii::$app->request->isAjax){ ?>
                <div class="form-group">
                    <?= Html::submitButton("保存", ['class' => 'btn btn-primary']) ?>
                </div>
            <?php } ?>
            <?php ActiveForm::end(); ?>
        </div>
    </div>
</div>

<?php JsBlock::begin(); ?>
    <script>

    </script>
<?php JsBlock::end(); ?>